<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="cn.firstsoft.firstframe.admin.PropertyFile"%>
<%@ page import="cn.firstsoft.firstframe.admin.XmlFile"%>
<%@ page import="cn.firstsoft.firstframe.admin.Field"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="../common.jsp"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    
    <title>设置</title>
   
	<link href="../style.css" type="text/css" rel=stylesheet>
	
  </head>
  
  <body>
 <% 
 	String type = request.getParameter("type")==null?"":request.getParameter("type");
 	List list = null;
 	if(type.equals("") || type.equals("all"))
	 	list = XmlFile.findAllFields();
	else
		list = XmlFile.findFields(type);
 %>
<c:set var="filterType" value="<%=type%>" />


<INPUT type=button value="新&nbsp;增" onclick="javascript:location.href='<c:url value="field_edit.jsp?method=add" />'"/>					
<p/>类型过滤：

<SELECT name="filterType" onchange="filter();">
	<OPTION value="all" <c:if test="${filterType=='all'}">selected="selected"</c:if> >--所有分类--</OPTION>
	<OPTION value="workflow" <c:if test="${filterType=='workflow'}">selected="selected"</c:if> >--工作流--</OPTION>
	<OPTION value="mail" <c:if test="${filterType=='mail'}">selected="selected"</c:if> >--邮件--</OPTION>
	<OPTION value="message" <c:if test="${filterType=='message'}">selected="selected"</c:if> >--消息--</OPTION>
	<OPTION value="other" <c:if test="${filterType=='other'}">selected="selected"</c:if> >--其他--</OPTION>
</SELECT>
<p/>
<c:set var="flag" value="${param.flag}" />
<c:if test="${not empty flag}">
	<c:if test="${flag=='suc'}">
		设置保存成功！

	</c:if>
	<c:if test="${flag=='err'}">
		设置保存失败！

	</c:if>
</c:if>

  <c:set var="list" value="<%=list%>" />
  	<table width="100%" align="center" >
  
		<tr class=listViewPaginationTdS1>
			<TH listViewPaginationTdS1  align="left">序号</TH>
			<TH listViewPaginationTdS1  align="left">类型</TH>
			<TH listViewPaginationTdS1  align="left">类型名称</TH>
			<TH listViewPaginationTdS1  align="left">字段</TH>
			<TH listViewPaginationTdS1  align="left">字段名称</TH>
			<TH listViewPaginationTdS1  align="left">修改</TH>
			<TH listViewPaginationTdS1  align="left">删除</TH>
		</tr>
  		<c:forEach items="${list}" var="fieldList">
  			<tr>
  				<td width="5%"  align="left">${fieldList.pos}</td>
  				<td width="10%"  align="left">${fieldList.type}</td>
  				<td width="10%"  align="left">${fieldList.typeCname}</td>
  				<td width="30%"  align="left">${fieldList.pname}</td>
  				<td width="35%"  align="left">${fieldList.cname}</td>
  				<td width="5%"  align="left">
	  				<a href="<c:url value="field_edit.jsp?method=edit&pname=${fieldList.pname}"/>">修改</a>
  				</td>
  				<td width="5%"  align="left">
  					<a href="#" onclick="if( confirm('确定删除吗？') ) { location.href='<c:url value="field_update.jsp?method=del&pname=${fieldList.pname}"/>'}">删除</a>
  				</td>  			
  			</tr>
  		</c:forEach>
  	</table>  	

    
  </body>
</html>
<script language="javascript">
<!--
	function filter()
	{
		var value = document.all.filterType.value;
		location.href='field_list.jsp?type='+value;
	}
//-->
</script>
